package com.yunhai.device.mqtt;


public class MqttTopicHandle {

    public static TopicEntity handleTopic( String topic ) throws Exception {
        if( topic == null ){
            return null;
        }
        String[] topics = topic.split("/");
        TopicEntity topicEntity = new TopicEntity();
        topicEntity.setDeviceType(topics[1]);
        topicEntity.setDeviceId(topics[2]);
        return topicEntity;
    }
}
